<?php
require_once ($INCLUDE_PATH . "./include/WebService2Db.php");
class DateModel {
    public function delDate($start_time,$end_time,$type) {
        $DB=new DB_MYSQL;
        $table=PRE."_send_email ";
            $t = "open_time";
       
      
        $sql = "DELETE FROM ".$table."WHERE ".$t.">  UNIX_TIMESTAMP('".$start_time."') or ". $t."< UNIX_TIMESTAMP('".$end_time."')";
        $DB->delete($sql,DB);
        return $DB->affected_rows;

    // echo $sum;
    }

	 public function downDate($start_time,$end_time) {
        $DB=new DB_MYSQL;
        $table=PRE."_send_email";
        $DB->connect();        
        $t = "open_time";
		if($start_time)
			$w = " AND`".$t."`>".strtotime($start_time);
        if($end_time)
			$w = " AND`".$t."`<".strtotime($end_time);
        
		$sql = "SELECT * FROM `".$table."` WHERE 1=1" .$w;
        $query = $DB->fetch_array($sql,DB);
        return $query;

    }

}
?>
